const express = require("express");
const app = express();
const port = 3000;

// 我们需要再重启一个端口，做即时通讯的端口
var server = app.listen(8082);
var io = require("socket.io").listen(server);

// 建立好之后我们就可以监听前端接入进来的消息了
io.on("connection", (socket) => {
  console.log("connect");
});

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});
